home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / 92052tar.gz / 920528.tar / proc.h < prev    next >
C/C++ Source or Header  |  1991-10-13  |  3KB  |  83 lines

  1. /* @(#) $Header: proc.h,v 1.2 91/10/11 18:56:34 deyke Exp $ */
  2.  
  3. #ifndef _PROC_H
  4. #define _PROC_H
  5.  
  6. #include <setjmp.h>
  7.  
  8. #ifndef _MBUF_H
  9. #include "mbuf.h"
  10. #endif
  11.  
  12. #ifndef _TIMER_H
  13. #include "timer.h"
  14. #endif
  15.  
  16. #define OUTBUFSIZE      512     /* Size to be malloc'ed for outbuf */
  17.  
  18. /* Kernel process control block */
  19. #define PHASH   16              /* Number of wait table hash chains */
  20. struct proc {
  21.     struct proc *prev;      /* Process table pointers */
  22.     struct proc *next;
  23.  
  24.     jmp_buf env;            /* Process state */
  25.     char i_state;           /* Process interrupt state */
  26.  
  27.     unsigned short state;
  28. #define READY   0
  29. #define WAITING 1
  30. #define SUSPEND 2
  31.     void *event;            /* Wait event */
  32.     int16 *stack;           /* Process stack */
  33.     unsigned stksize;       /* Size of same */
  34.     char *name;             /* Arbitrary user-assigned name */
  35.     int retval;             /* Return value from next pwait() */
  36.     struct timer alarm;     /* Alarm clock timer */
  37.     struct mbuf *outbuf;    /* Terminal output buffer */
  38.     int input;              /* standard input socket */
  39.     int output;             /* standard output socket */
  40.     int iarg;               /* Copy of iarg */
  41.     void *parg1;            /* Copy of parg1 */
  42.     void *parg2;            /* Copy of parg2 */
  43.     int freeargs;           /* Free args on termination if set */
  44. };
  45. #define NULLPROC (struct proc *)0
  46. extern struct proc *Waittab[];  /* Head of wait list */
  47. extern struct proc *Rdytab;     /* Head of ready list */
  48. extern struct proc *Curproc;    /* Currently running process */
  49. extern struct proc *Susptab;    /* Suspended processes */
  50. extern int Stkchk;              /* Stack checking flag */
  51.  
  52. /* In  kernel.c: */
  53. void alert __ARGS((struct proc *pp,int val));
  54. void chname __ARGS((struct proc *pp,char *newname));
  55. void killproc __ARGS((struct proc *pp));
  56. void killself __ARGS((void));
  57. struct proc *mainproc __ARGS((char *name));
  58. struct proc *newproc __ARGS((char *name,unsigned int stksize,
  59.     void (*pc) __ARGS((int,void *,void *)),
  60.     int iarg,void *parg1,void *parg2,int freeargs));
  61. int psignal __ARGS((void *event,int n));
  62. int pwait __ARGS((void *event));
  63. void resume __ARGS((struct proc *pp));
  64. void suspend __ARGS((struct proc *pp));
  65.  
  66. /* In ksubr.c: */
  67. void chkstk __ARGS((void));
  68. void kinit __ARGS((void));
  69. unsigned phash __ARGS((void *event));
  70. void psetup __ARGS((struct proc *pp,int iarg,void *parg1,void *parg2,
  71.     void  __ARGS(((*pc) __ARGS((int,void *,void *)) )) ));
  72. #ifdef  AMIGA
  73. void init_psetup __ARGS((struct proc *pp));
  74. #endif
  75.  
  76. /* Stack background fill value for high water mark checking */
  77. #define STACKPAT        0x55aa
  78.  
  79. /* Value stashed in location 0 to detect null pointer dereferences */
  80. #define NULLPAT         0xdead
  81.  
  82. #endif  /* _PROC_H */
  83.